Magnetically induced electric polarization reversal in multiferroic TbMn_{2}O_{5}: Terbium spin reorientation studied by resonant x-ray diffraction