# Nonlinear GPE of a solid block seems wrong

I am trying to calculate the gravitational potential of a solid block, and I have a nonlinear answer which strikes me as wrong.

A block with horizontal surface area $$A [m^{-2}]$$ and uniform density $$\rho[kg\cdot m^{-3}]$$ has its base at height $$H_0[m]$$ and its top at height $$H_1$$, total mass is $$m=\rho A(H_1-H_0) [kg]$$.

Considering horizontal slices in a uniform gravity field, I wrote down this for total GPE:

$$\int_{H_0}^{H_1}\mathrm{d}E=\int_{H_0}^{H_1}gh\ \mathrm{d}m=\int_{H_0}^{H_1}\rho Agh\ \mathrm{d}h=\rho Ag\int_{H_0}^{H_1}h\ \mathrm{d}h=\frac{1}{2}\rho Ag(H_1^2-H_0^2)$$

But this isn't translation-independent, I get a different answer if I change the heights to $$H_0+x$$ and $$H_1+x$$. My intuition tells me this is wrong, shouldn't I get the same GPE as for a point mass at height $$\frac{H_0+H_1}{2}$$, which would be translation-independent?

What is my mistake?

Your answer is $$\frac 12 \rho g A (H_1^2-H_0^2)= \rho g A (H_1-H_0)[(H_1+H_2)/2]\\ = \hbox{density\times volume} \times g (H_1+H_2)/2\\ = \hbox{Mass} \times g \times \hbox{height of center of mass}\\ = Mgh$$ which is correct.