Nontrivial beam modulation with polarization gratings