Polarization of direct photons from gluon anisotropy in ultrarelativistic heavy ion collisions