We have studied the prototype hybrid organic-inorganic perovskite CH3NH3PbI3 and its three close relatives, CH3NH3SnI3, CH3NH3PbCl3 and CsPbI3, using relativistic density function theory. The long-range van der Waals (vdW) interactions were incorporated into the Perdew-Burke-Ernzerhof (PBE) exchange-correlation functional using the Tkatchenko-Scheffler pairwise scheme. Our results reveal that hydrogen bonding, which is well described by the PBE functional, plays a decisive role for the structural parameters of these systems, including the position and orientation of the organic cation as well as the deformation of the inorganic framework. The magnitude of the inorganic-framework deformation depends sensitively on the orientation of the organic cation, and directly influences the stability of the hybrid perovskites. Our results suggest that the organic and the inorganic components complement each other: The low symmetry of the organic cation is the origin of the inorganic-framework deformation, which then aids the overall stabilization of the hybrid perovskite structure. This stabilization is indirectly affected by vdW interactions, which lead to smaller unit-cell volumes than in PBE and therefore modulate the interaction between the organic cation and the inorganic framework. The vdW-induced lattice-constant corrections are system dependent and lead to PBE+vdW lattice constants in good agreement with experiment. Further insight is gained by analysing the vdW contributions. In all iodide-based hybrid perovskites the interaction between the organic cation and the iodide anions provides the largest lattice-constant change, followed by iodine-iodine and the organic cation - heavy-metal cation interaction. These corrections follow an almost linear dependence on the lattice constant within the range considered in our study, and are therefore approximately additive.