Generalized scattering-matrix approach for magneto-optics in periodically patterned multilayer systems