One way this can work is if soldiers at the corners are considered to guard two walls. In the most symmetric solution, we can then place $2$ soldiers at each corner, and $5$ along the middle of each side (so $2+5+2=9$ protecting each side).
But really any solution in which there are a total of $8$ soldiers at the four corners will work, e.g.
$$\begin{array}{ccc} 1&6&2\\\6& &4\\\2&4&3 \end{array}$$