It is very important that you check every step that I take, try to understand what I do.
Think of a cuboid like this one:
The shape with sides A and B is a quarter of the whole shape with sides C and D. The column with sides a and b is very narrow, where a and b tend to go to zero.
The total moment of intertia is given by: [itex]I = \sum\limits_{i=1}^n m_ir_i^2[/itex]
Calculating the mass of the narrow column: [itex]m=ρabh[/itex]
(assuming the mass-desnsity is homogenous, we call it ρ)
The distance from the axis of rotation:
[itex]r=\sqrt{a^2+b^2}[/itex]
So
[itex]I=ρh\int_a^A\int_b^B(a^2+b^2)da db<br />
=hρ\int_a^A\frac{1}{3}B^3+Ba^2da<br />
=hρ[\frac{1}{3}B^3A+\frac{1}{3}BA^3]<br />
=\frac{1}{3}hρBA(B^2+A^2)[/itex]But we do not have one of those blocks, but four of them, so multiply by four gives:
[itex]I=\frac{4}{3}hρBA(B^2+A^2)[/itex]
From the image on the beginning, we can conclude that A=C/2, and that B=D/2,
putting this into the last equation gives:
[itex]I=\frac{1}{12}hρCD(C^2+D^2)[/itex]
The mass of such a cuboid is given by
[itex]m=ρABh[/itex]
so
[itex]I=\frac{1}{12}m(C^2+D^2)[/itex]
If you were to replace the C and D with w, d or h, you will get your answer.