Just apply the method to each integral, for example, for the trapezoidal rule
\begin{eqnarray} \int_1^4 \color{blue}{\left(\int_1^4f(x,y){\rm d}x\right)}{\rm d}y &=& \int_1^4 \color{blue}{\left(\frac{4-1}{2}[f(1,y) + f(4,y)]\right)}{\rm d}y \\\ &=& \frac{3}{2}\left\\{ \color{red}{\int_1^4f(1,y){\rm d}y} + \color{orange}{\int_1^4f(4,y){\rm d}y}\right\\} \\\ &=& \frac{3}{2}\left\\{\color{red}{\frac{4-1}{2}[f(1,1) + f(1,4)]} + \color{orange}{\frac{4-1}{2}[f(4,1) + f(4,4)]} \right\\} \\\ &=& \frac{9}{4}\left[ f(1,1) + f(1,4) + f(4,1) + f(4,4)\right] \end{eqnarray}