The fact that the right hand side contains $f(a)$, $f(b)$, $f^\prime(a)$ and $f^\prime(b)$ makes me think to the application of the integration by parts.
Indeed, on integrating by parts the first time, we have
$$\int_a^b f(x)dx=\left[xf(x) \right]_a^b-\int_a^bxf^\prime(x)dx$$
On integrating by parts the second time, we finally have
$$\int_a^b f(x)dx=-af(a)+bf(b)+\frac{a^2}{2}f^\prime(a)-\frac{b^2}{2}f^\prime(b)+\int_a^b\frac{x^2}{2}f^{\prime\prime}(x)dx.$$
giving $w_0=-a$, $w_1=b$, $w_2=a^2/2$ and $w_3=-b^2/2$.
The error of this formula is provided by
$$R(x)=\int_a^b\frac{x^2}{2}f^{\prime\prime}(x)dx$$
which is vanishing if $f^{\prime\prime}(x)=0$, namely, if $f^\prime(x)=c$ or $f(x)=cx+d$. So, the above integration formula is exact for polynomials of degree $1$.