Text this: The factorization method for inverse scattering from periodic inhomogeneous media