You said you read that $\ce{MgH2}$ has a structure of rutile. Actually it is $\alpha$-$\ce{MgH2}$, which forms at room temperature and atmospheric pressure and have rutile type structure. The crystal structure of $\alpha$-$\ce{MgD2}$ was studied as early as 1963 (Ref.1). The abstract states that:
A magnesium deuteride preparation of composition $\ce{Mg(D_{0.9}H_{0.1})2}$ is found to be tetragonal with $a = 4.5025, c = \pu{3.0123 \mathring A }$. The atomic positions are: $\ce{2 Mg}$ in $(000)(\frac12 \frac12 \frac12)$, $\ce{4 D + H}$ in $\pm (xx0)(\frac12 +x, \frac12 –x, \frac12)$ with $x = 0.306 \pm 0.003$. The bond lengths are $\ce{Mg-6D} = \pu{1.95 \pm 0.02 \mathring A }$. The structure is of rutile type.
The authors state that the choice of $\ce{MgD2}$ in place of $\ce{MgH2}$ because hydrogen atoms had no measurable effects on diffraction intensities (note that they were doing neutron diffraction studies). These studies were a followup to confirm their previous studied on $\ce{MgH2}$ (Ellinger, et al. in 1955; Ref.2). In that studies on $\ce{MgH2}$ with X-ray diffraction, it has been shown that $\ce{MgH2}$ crystallizes in the tetragonal system with $a_\circ = \pu{4.5168 \mathring A}$ and $c_\circ = \pu{3.0205 \mathring A}$. The measured density of the crystals was $\pu{1.45 \pm 0.03 g/cm-3}$, which has shown that there are two molecules in the unit cell (Ref.2). The calculated X-ray density is $\pu{1.419 g/cm-3}$.
The last statement answers your question. The rutile type structure provide two $\ce{MgH2}$ molecules in the unit cell. There are one $\ce{Mg}$ atom in the center (shares with one unit cell) and eight other $\ce{Mg}$ atoms at corners, each of which shares it with eight unit cells. Thus, number of $\ce{Mg}$ atoms in a unit cell is: $1 \times 1 + 8 \times \frac {1}{8}=2$. There are six $\ce{H}$ atoms in the unit cell. If you look closely, you'd realize two of them in inside the unit cell (shares with one unit cell) and rest are on two opposite surfaces, two in each surface (two $\ce{H}$ atoms in each surface share with two unit cells). Thus, number of $\ce{H}$ atoms in a unit cell is: $2 \times 1 + 4 \times \frac {1}{2}=4$. Hence, number of $\ce{MgH2}$ molecules in a unit cell is $\ce{Mg2H4 # 2 MgH2}$.
The X-ray powder pattern shows that two $\ce{Mg}$ atoms in the unit cell are in a body-centered configuration, i.e. $\ce{2 Mg}$ in $(000)(\frac12 \frac12 \frac12)$. A consideration of all tetragonal space groups shows that there is one and only one possible choice of positions for the four $\ce{H}$ atoms leading to a plausible structure. This is,
$$\text{space group } P4/mnm \ \left(D^{14}_{4h} \right)\\
\ce{2Mg} \text { in } (000)(\frac12 \frac12 \frac12)\\
\ce{4H} \text { in } \pm (XX0)\left(X + \frac12, \frac12-X, \frac12\right) \ \text{with } X=0.306$$
In this structure (rutile type), each magnesium is coordinated to six hydrogens at a distance of $\pu{1.95 \mathring A}$ and each hydrogen is coordinated to three magnesiums. One $\ce{H-H}$ distance is $\pu{2.49 \mathring A}$ and the others are $\pu{2.76 \mathring A}$. The distance of $\pu{2.76 \mathring A}$ compares favorably with the diameter of $\ce{H-}$ ion ($\pu{2.72 \mathring A}$) as found in $\ce{LiH}$. One short $\ce{H-H}$ distance is characteristic of one anion-anion distance of the rutile type structure.
By these statements, it can be concluded that the structure of $\alpha$-$\ce{MgH2}$ is indeed rutile type (not body-centered cube).
In another point of view, one would also suggest that the structure of $\alpha$-$\ce{MgH2}$ is face-centered cube, based on equal distances of $\ce{6 Mg-H}$ (see $\color{blue}{\text{blue box}}$ in following diagram; opposite face $\ce{H}$ atoms are highlighted in blue, red, and gray for visualization). However, again, calculations lead to $\ce{MgH3}$ in the unit cell, which would rule out the possibility.
The above diagram shows the crystal structures of other modifications of $\ce{MgH2}$ along with $\alpha$-$\ce{MgH2}$ (Ref.3 & 4). These other modifications are formed in high pressure situations. For example, when low-pressure phase $\alpha$-$\ce{MgH2}$ was heated at $\pu{1070 K}$ and in $\pu{2 GPa}$ pressure, the high-pressure phase $\gamma$-$\ce{MgH2}$ was formed in the orthorhombic (space group: $Pbcn$) structure (Ref.3):
The high-pressure phase $\gamma$-$\ce{MgH2}$ was formed by heating the low-pressure phase $\alpha$-$\ce{MgH2}$ in a multianvil press at $\pu{2 GPa}$ pressure to $\pu{1070 K}$ for $\pu{120 min}$ and successive rapid quenching. Investigation by X-ray and neutron powder diffraction on the deuteride at ambient conditions revealed that it crystallises with the orthorhombic $\alpha$-$\ce{PbO2}$ type structure (space group $Pbcn, Z=4, a=4.5213(3), b=5.4382(3), c= \pu{4.9337(3) \mathring A }$ (hydride); $a=4.5056(3), b=5.4212(3), c= \pu{4.9183(3) \mathring A}$ (deuteride) at $T=\pu{295 K}$). The deuterium atoms surround magnesium in a distorted octahedral configuration with bond distances $\ce{Mg-D} = 1.915(3), 1.943(3)$ and $\pu{2.004(3) \mathring A }$. The rutile structure of $\alpha$-$\ce{MgH2}$ was re-evaluated.
The bonding nature of $\ce{MgH2}$ is analyzed in recent studies with the help of charge-density, charge-transfer, electron-localization-function, and Mulliken-population analyses, which clearly have shown that all polymorphs of $\ce{MgH2}$ are to be classified as ionic materials with $\ce{Mg}$ and $\ce{H}$ in nearly 2+ and 1− states, respectively (Ref.4).
References:
- W. H. Zachariasen, C. E. Holley, Jr., J. F. Stamper, Jr., “Neutron diffraction study of magnesium deuteride ,” Acta Chrystallographica 1963, 16(5), 352-353 (https://doi.org/10.1107/S0365110X63000967).
- F. H. Ellinger, C. E. Holley, Jr., B. B. McInteer, D. Pavone, R. M. Potter, E. Staritzky, W. H. Zachariasen, “The Preparation and Some Properties of Magnesium Hydride,” J. Am. Chem. Soc. 1955, 77(9), 2647–2648 (https://doi.org/10.1021/ja01614a094).
- M. Bortz, B. Bertheville, G. Böttger, K. Yvon, “Structure of the high pressure phase $\gamma$-$\ce{MgH2}$ by neutron powder diffraction,” Journal of Alloys and Compounds 1999, 287(1-2), L4-L6 (https://doi.org/10.1016/S0925-8388(99)00028-6).
- P. Vajeeston, P. Ravindran, B. C. Hauback, H. Fjellvåg, A. Kjekshus, S. Furuseth, M. Hanfland, “Structural stability and pressure-induced phase transitions in $\ce{MgH2}$,” Phys. Rev. 2006, B73, 224102 (https://doi.org/10.1103/PhysRevB.73.224102).