Exact quantization of a paraxial electromagnetic field