The Factorization Method for Inverse Scattering from Periodic Inhomogeneous Media