We have a (possibly nonpolynomial) function $w\colon\mathbb Z\to \mathbb N_0$ such that $W(x)=w(x)^2$ for all $x\in \mathbb Z$.
If $a<0$ then $W(x)<0$ for sufficiently big $x$. Hence $a\ge 0$. If $a=0$ and $b\ne 0$, then again $W(x)<0$ for suitable $x$. Hence $a=0$ implies $b=0$, but then $W(x)=W(0)=(w(0))^2$ as desired. Therefore we may assume for the rest of the argument that $a\ne 0$.
If $x$ is big, then $w(x)\approx x\sqrt a$. More precisely, if $\alpha,\beta$ are positive real numbers, then from $\alpha^2-\beta^2=(\alpha-\beta)(\alpha+\beta)$ we see that $|\alpha-\beta|\le\frac{|\alpha^2-\beta^2|}\alpha$. Therefore, from $(x\sqrt a+\frac{b}{2\sqrt a})^2-w(x)^2=\frac{b^2}{4a}-c$, we conclude $\tag1w(x)=x\sqrt a +\frac b{2\sqrt a}+O(x^{-1}).$
If $b=c=0$, then $a=w(1)^2$ and we have $W(x)=(w(1)x)^2$ as desired. Therefore we may assume that $b\ne0$ or $c\ne 0$, hence we can consider $d=\gcd(b,w(0))$ and write $b=du$, $c=d^2v^2$ with $u,v\in\mathbb Z$. Then if $p|v$, we have that $W(p)=ap^2+dup+c$ is a multiple of $p$, but not of $p^2$, contradicting squareness. Consequently, $v=1$, $d=w(0)$, $c=d^2$ and $d|b$.
As $W(\pm d)=ad^2\pm ud^2+d^2$ is divisible by $d^2$, we see that $w(\pm d)$ is divisible by $d$ and $2u=\left(\frac {w(d)}{d}\right)^2-\left(\frac{w(-d)}{d}\right)$ is the difference of two squares. But if a difference of squares is even, it is also a multiple of four. We conclude that $u$ is even. Therefore write $b=2dh$ with $h\in\mathbb Z$. Then $\tag2W(x) = ax^2+2dhx+d^2=(hx+d)^2+(a-h^2)x^2.$ Thus if $h^2=a$, we are done. Therefore assume that $h\ne \pm\sqrt a$. From $(2)$ we obtain $(a-h^2)x^2=(w(x)+hx+d)(w(x)-hx-d)$. Thus $(a-h^2)x^2$ has factors $w(x)+hx+d=(\sqrt a +h)x+O(1)$ and $w(x)-hx-d=(\sqrt a -h)x+O(1)$. As $x\to \infty$, both factors are unbounded, hence for a large enough prime $x$, each factor exceeds $a^2-h$ (in absolute value) and hence must be divisible by $x$ (but not $x^2$). After dividing out $x$, this implies that $a-h^2$ has integer factors $\sqrt a +h+O(x^{-1})$ and $\sqrt a -h+O(x^{-1})$. As $x$ can grow arbitrary large, $\sqrt a\pm h$ must be integer, especially $n:=\sqrt a$ is an integer. But then from $(1)$ we have $\frac{b}{2n}=w(x)-nx+O(x^{-1})$ and this implies that $m:=\frac{b}{2n}$ is an integer because $w(x)-nx$ is an integer and $O(x^{-1})$ arbitrarily small. We obtain $W(x)=(n x+m)^2+c-m^2$, hence $c-m^2 = (w(x)-nx-m)(w(x)+nx+m)$. The second factor is unbounded hence the first factor becomes arbitrarily small. But as it is an integer, this means that it becomes $0$ for large $x$. Therefore $c=m^2$ and $W(x)=(n x+m)^2.$