RAPTOR. II. Polarized radiative transfer in curved spacetime