(click to zoom)
The limit-density on the left border is 0, density max = 1/2 -and the gradient is linear.
That means the vertical density average is linear-proportionnal to the left-right axis, for ex. the density in the middle is 1/4 -and the densities at the first and second quarters are respectively 1/8 and 3/8.
The sum of the density over the entire rectangle thus is +- 1/4-like that:
(Errata: read (-1/4) instead of (-1/2)!)