Solution:
For the purpose of explaining this solution, let's label the squares as
11121314
21222324
31323334
41424344
Note that since the corner squares 11,14,41,44 each only have two neighbors, each corner square is the same color as both of its neighbors (for example, 11,12, and 21 are the same color, 31,41, and 42 are the same color, etc.). This corner square constraint heavily limits the possible colorings. We will now use casework.
Case 1: Suppose two corner squares on the same side (without loss of generality, let them be 11 and 14) have the same color (without loss of generality, red). Then 21,11,12,13,14,24 are all red, and 12 has two red neighbors (11 and 13) so its third neighbor (22) is a color different from red (without loss of generality, magenta). But 22 has two red neighbors (12 and 21), so its other two neighbors (23 and 32) must be magenta. Applying the same logic symmetrically, we find that all four interior squares (22,23,32,33) have the same color. Furthermore, 21 has one magenta neighbor 22, so 31 must be red. Symmetrically, 34 is red, and by the corner square constraint we have that all the exterior squares are the same color. Thus in general, this case is equivalent to a window taking the following form (with distinct colors A and B):
AAAAABBAABBAAAAA
The number of choices of A and B is 3⋅2=6.
Case 2: No two corner squares on the same side have the same color.
Then from the corner square constraint 12 has neighbor 11 of the same color and neighbor 13 of a different color, so its neighbor 22 must be the same color as 12. Therefore, this case is equivalent to coloring each quadrant entirely in one color such that two quadrants sharing a side have different colors. (A quadrant refers to the four squares on one vertical half and one horizontal half, e.g. 13,14,23,24). If only two colors are used, the window will take the form (with distinct colors A and B):
AABBAABBBBAABBAA
Again there are 3⋅2=6 ways to choose A and B.
If all three colors are used, the window will take the form (with distinct colors A,B and C):
AACCAACCBBAABBAA
or
There are
3⋅2⋅1=6 ways to select colors for each of these forms.
Therefore, there are 6 colorings in Case 1 and 6+6+6 in Case 2, for a total of 24 colorings.