The rotational dynamics of an organic cation in hybrid halide perovskites is intricately linked to the phase transitions that are known to occur in these materials; however, the exact relation is not clear. We have performed detailed model studies on methylammonium lead iodide and formamidinium lead iodide to unravel the relation between rotational dynamics and phase behavior. We show that the occurrence of the phase transitions is due to a subtle interplay between dipole-dipole interactions between the organic cations, specific (hydrogen bonding) interactions between the organic cation and the lead iodide lattice, and deformation of the lead iodide lattice in reaction to the reduced rotational motion of the organic cations. This combination of factors results in phase transitions at specific temperatures, leading to the formation of large organized domains of dipoles. The latter can have significant effects on the electronic structure of these materials.