I've got no problems with calculating the moment of inertia/tensor of inertia of a cube using an integral over the lamina of a cube. However, I must be missing something obvious or making some sort of silly mistake but doing an integral over all three dimensions like
$$ \int_V \rho r^2 dV = \int_V \rho (x^2 + y^2 + z^2) dxdydz,$$
does not give the correct answer. Is there something I am missing in why this is not actually valid?