The hydrostatic pressure $P$ "is the pressure exerted by a fluid at equilibrium due to the force of gravity". "For water and other liquids $P$ can be calculated according to the following formula" $ P=\rho gh,\tag{1} $
where
- $P$ is the hydrostatic pressure at a generic point $H(\text{measured in }\textrm{Pa } \equiv $ Pascal above the sea-level atmospheric pressure$^1$)
- $\rho $ is the liquid density ($\textrm{kg/m}^{3}$),
- $g$ is the gravitational acceleration ($\mathrm{m/s}^{2}$),
- $h$ is the height of the fluid column above $H\; (\textrm{m}).$
[Remark: Had we considered $P$ as an absolute pressure, we would have to add to $(1)$ the term $P_{\text{atm}}$, i.e. the mean sea level atmospheric pressure$^1$
$ P=\rho gh+P_{\text{atm}},\tag{1a} $
and adapt the numeric computation below accordingly. For the sake of simplicity we consider in this problem equation $(1)$ only.]
Since the water density $\rho \approx 1000 \textrm{kg/m}^{3}$ and the gravitational acceleration $g=9.81 \textrm{m/s}^{2}$, we have $ P(h)=9810h.\tag{2} $
So the hydrostatic pressure is a function of the single variable $h$, the height of the water column (in meters), i.e. the depth below the surface of $H$. Since $ 1\text{ }\mathrm{ft\ }=0.3048\text{ }\mathrm{m}, $ the hydrostatic pressure at $a=2 \textrm{ft }=2\times 0.3048 =0.6096\; \textrm{m}$ below the surface is $ P(a)=9810\times 0.609\,6=5980.176\text{ }\mathrm{Pa}\; $ and at $b=2+4=6 \textrm{ft }=6\times 0.3048=1.828\,8 \textrm{m},$ $ P(b)=9810\times 1.828\,8=17940.528\text{ }\mathrm{Pa}. $
If the rectangle was placed horizontally at e.g. $b$ the hydrostatic force $F$ (in Newtons) would be the product of $P(b)$ by the rectangle area $A=6\times 4=24\;\textrm{ft}^{2}=24\times 0.3048^{2}$ $=2.22967296\;\mathrm{m}^{2}$ $ F_{\text{horizontally at }b}=P(b)\times A=17940.528\times 2.22967296=40001.51\text{ }\mathrm{N} $ If it was placed horizontally at $a$, a similar computation would give $ F_{\text{horizontally at }a}=P(a)\times A=13333.84\text{ }\mathrm{N} $

Since the rectangle is vertical the hydrostatic pressure exerted on it is not constant, but depends on the variable $h$ (see sketch). Hence, to find the total hydrostatic force $F$ we need to add all the contributions of the hydrostatic force element $dF=P(h)\;dA$ exerted on the area element $dA=w\;dh,$ where $w=6\; \textrm{ft }=\textrm{ }1.8288 \textrm{m}$ is the rectangle width and $dh$ is the height element $ dF=P(h)\;dA=P(h)\,w\;dh=9810h\,w\;dh,\quad h\in \left[ a,b\right]\tag{3} $ So, the total hydrostatic force (in Newtons) exerted by the water on the rectangle is the defined integral$^3$ $\begin{eqnarray*} F &=&\int_{a}^{b}dP=\int_{a}^{b}P(h)w\;dh=\int_{a}^{b}9810h\,w\;dh=9810\,w \int_{a}^{b}h\;dh \\ &=&\left. 9810\,w\times \frac{h^{2}}{2}\right\vert _{a}^{b}=9810\times 1.828\,8\left( \frac{b^{2}}{2}-\frac{a^{2}}{2}\right) \\ &=&\frac{9810\times 1.828\,8}{2}\left( 1.828\,8^{2}-0.609\,6^{2}\right) \\ &=&26667.67\text{ }\mathrm{N}=5995.1\text{ }\mathrm{lbf\quad }\text{(conversion of force units as per foot-note 2)}.\tag{4} \end{eqnarray*}$
This value is of course less than $40001.51$ and greater than $13333.84$ computed above. Due to the linearity of the formula $(2)$, we have the following relation:
$F=\frac{F_{\text{horizontally at }a}+F_{\text{horizontally at }b}}{2},$
which means that we could have found $F$ without evaluating the integral $(4)$.
--
$^{1}$ Mean sea level pressure: $P_{\text{atm}}=101325\; \textrm{Pa} =14.7\; \textrm{psi}$
$^{2}$ Conversion of units: $1$ pound-force $=1\; \textrm{lbf }\equiv g\times 1\; \textrm{lb} \approx 4.448221615\; \textrm{N}$
$^3$ Note: this integral is the limit of a Riemann sum.