find the volume of a pyramid, whose base is a square of side b and height is h

consider a partition of the x-axis and subdivide into this slices with square cross-sections

i can do this with partitions of the y-axis but is this question i have to do it with partitions of the x-axis

i cant seem to do this, can someone help me out and write down the expression for the volume explaining how they got each part

i've been trying this for hours