Precision vibrational spectroscopy of the molecular hydrogen ions is of significant interest for determining fundamental constants, for searching for new forces, and for testing quantum electrodynamics calculations. Future experiments can profit from the ability of preparing molecular hydrogen ions at ultralow kinetic energy and in preselected internal states, with respect to vibration, rotation, and spin degrees of freedom. For the homonuclear ions (H 2 + , D 2 + ), direct laser cooling of the rotational degree of freedom is not feasible. We show by quantum calculations that rotational cooling by cold He buffer gas is an effective approach. For this purpose we have computed the energy-dependent cross sections for rotationally elastic and inelastic collisions, h 2 + (v = 0, N) + He → h 2 + (v = 0, N ) + He (where h = H, D), using ab initio coupled-channel calculations. We find that rotational cooling to the lowest rotational state is possible within tens of seconds under experimentally realistic conditions. We furthermore describe possible protocols for the preparation of a single quantum state, where also the spin state is well defined.