If the axis of rotation of a body, as shown in the (removed) figure, does not pass through its center of mass, the formula for calculating the moment of inertia must be modified.
Let $x_\mathrm{D}$ and $y_\mathrm{D}$ be the coordinates of the rotation axis vector $\vec{r}_\mathrm{D}$, and place the origin of the coordinate system at the center of mass of the body. Then, the moment of inertia with respect to this new point can be calculated using the length of the vector $\vec{r} - \vec{r}_\mathrm{D}$:
$$
I = \int \left((x - x_\mathrm{D})^2 + (y - y_\mathrm{D})^2\right)\,\mathrm{d}m
$$
Expanding the squared terms using the binomial formula gives:
$$
I = \underbrace{\int (x^2 + y^2)\,\mathrm{d}m}_{I_0} - \underbrace{2x_\mathrm{D}\int x\,\mathrm{d}m}_0 - \underbrace{2y_\mathrm{D}\int y\,\mathrm{d}m}_0 + \underbrace{\int (x_\mathrm{D}^2 + y_\mathrm{D}^2)\,\mathrm{d}m}_{md^2}
$$
The first term gives the moment of inertia $I_0$, which is the moment of inertia relative to the center of mass of the body. The second and third terms vanish because they correspond to the definition of the center of mass, which coincides with the origin of the coordinate system by definition. The last term is a constant that depends only on the distance $d$ between the center of mass and the rotation axis, and on the total mass $m$ of the body. From that, Steiner's theorem can immediatly be written down.
Steiner's Theorem
If a body with the mass $m$ rotates around a axis which has the distance $d$ to its center of mass, then the momentum of inertia is given as
$$
I = I_0 + md^2
$$
The momentum of inertia with respect to its center of gravity is $I_0$.
This theorem is advantageous for measuring and calculating moments of inertia of complex geometries, since they can be divided into smaller parts, each of which can be calculated more easily.
Steiner’s theorem also shows that a body has a minimal moment of inertia, which occurs when the rotation axis passes through the center of mass, because in this case the additional term $md^2$ disappears.