Theory of the optical properties of excitons in a homogeneous magnetic field