Here is an example that may make the things clear. (It is not a solution by example, but a way to visualize the solution using a special example.)
Note: In an initial version of the question, the solution was linked to
AOPS Problem + Solutions .
This page may have a shorter or longer life, but next days it will be there, so the reader may want to look at the many solutions having one common idea.
Let us build a configuration, by placing some stars on the white fields of the following empty board, already divided in $2\times2$-squares.
The fill-in-rule wants that no two (at a corner) touching white fields
(from the same and/or touching $2\times2$-squares)
get stars in the same time. And each $2\times2$-square has exactly one star (in a white field).
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
\end{array}
$$
In this choice, the left upper corner is white.
If the checker board is "the other one", just use a vertical reflection to reduce to this case (since the right upper corner is than white, so the reflection fits the above pattern).
When we use the left/upper field, than we also use the red color:
$$
\begin{array}{|cc|}
\hline
\color{red}*& \blacksquare \\
\blacksquare &
\\\hline
\end{array}
\text{ and abbreviate this as }
\color{red}{\blacksquare}
$$
When we use the right/lower field, than we also use the blue color:
$$
\begin{array}{|cc|}
\hline
& \blacksquare \\
\blacksquare & \color{blue}*
\\\hline
\end{array}
\text{ and abbreviate this as }
\color{blue}{\blacksquare}
$$
Now we will fill in first the first row only, one $2\times2$-square after the next one, starting from left to right.
A first observation is that if somewhere on this row we use the blue pattern, than all (right) following $2\times2$-squares are blue.
So the first row may be
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}* &
\blacksquare & \color{blue}* &
\blacksquare & \color{blue}*
\\\hline
\end{array}
$$
and we encode it for short simply as:
$$
\color{red}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
$$
This "simple scheme" to represent the filling is the key to the solution.
Let us fill now the first two rows, and observe the constraints.
First of all we must have in the simple scheme blue under blue, i.e.
$$
\color{red}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
\\
\color{gray}{\blacksquare \blacksquare }\color{blue}{\blacksquare \blacksquare \blacksquare }
$$
and the gray squares have some choices. But each choice should give connected intervals of $\color{red}{\blacksquare}$ and of $\color{blue}{\blacksquare}$ pieces in the "simple scheme".
With this convention, the possible solution
$$
\begin{array}{|cc|cc|cc|cc|cc|}
\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare &
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\color{red}*& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & &
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare &
& \blacksquare
\\
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*&
\blacksquare & \color{blue}*
\\\hline
\end{array}
$$
is translated in simple scheme as
$$
\begin{array}{ccccc}
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{red}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\\
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare &
\color{blue}\blacksquare
\end{array}
$$
and the social distancing of red and blue translates further as a record or the right most red square, its column number, considered row after row.
So the above simple scheme translates as the tuple:
$$
(5,3,3,2,1,0)\ .
$$
There are $6$ entries, so many as the rows, and the entries are non-increasing.
Since we hate repetitions in the tuple, we will do the following new translation. Add on its last entry $\color{magenta}1$, on the forelast entry $\color{magenta}2$, and so on, $\color{magenta}3,\color{magenta}4,\color{magenta}5,\color{magenta}6$, so that the new tuple becomes
$$
(5+\color{magenta}6, 3+\color{magenta}5,3+\color{magenta}4,2+\color{magenta}3,1+\color{magenta}2,0+\color{magenta}1)=
(11, 8,7,5,3,1)\ .
$$
This last tuple has six different entries between $1$ and $5+\color{magenta}6$.
By following this encoding process in reverse order, we observe that this makes sense (injectivity of the map), and decoding each tuple obtained from decreasingly rearranging an element of the appropriate $\binom {5+6}6$ combinations also makes sense (surjectivity of the encoding, when the codomain is made out of these combinations).
The general case works along the same lines. Just use $m,n$ instead of $6,5$.
Best Answer
Let's say $m$ is the number of rows and $n$ is the number of columns.
If $m$ is odd, then we can find a simple valid coloring by coloring alternate rows black and white (except for the black borders of course). If $n$ is odd, we can do the same thing with the columns to find a valid coloring.
The case remains where $m$ and $n$ are both even. Claim: there is no valid coloring in this case.
Proof: Assume the claim is false, i.e. there is a valid coloring when $m$ and $n$ are both even.
Consider the interior corners of the grid, and color them red and blue in a checkerboard pattern as in the image below. Now construct a graph using these corners as vertices, connecting two corners along a grid edge if and only if the edge separates a black square and a white square.
Now for each vertex of this graph, the colouring rules enforce that exactly two edges are incident to this vertex. Furthermore, every edge connects a red vertex with a blue vertex.
So the number of edges is exactly twice the number of red vertices (there are two edges for each red vertex), and the number of edges is also exactly twice the number of blue vertices. That means there are as many red vertices as blue vertices, so the total number of vertices is even.
But wait, that's impossible! Because the total number of vertices is exactly $(m-1)(n-1)$, which is a product of two odd numbers and therefore odd. We have a contradiction, so our last assumption is false, therefore the claim is true.
Alternate contradiction: Ignoring the vertex colors, if there are two vertices incident to each edge and two edges incident to each vertex, then the number of vertices and edges is the same. There's an odd number of vertices, so there's an odd number of edges.
However, in each column of squares, there's an even number of horizontal edges, since the squares change between black and white an even number of times in the row. Similarly, in each row of squares, there's an even number of vertical edges. Summing all these even numbers, we count each edge exactly once, so the total number of edges must be even. That's a contradiction.