We call the squares corners, edges or the center, according to their position. We first consider the case that the center is colored red.
(1) The edges must be colored into blue or yellow. There are 2 ways to color a square on the corner if the two squares next to it have the same color, and there are 1 way if otherwise. Split the cases by how the edges are colored.
(i) If all 4 edges have the same color, there are 2×24=32 ways.
(ii) If exactly 3 edges have the same color, there are 4 ways to choose the edge with the different color, 2 ways to choose its color, and 22 ways to color the corners. Therefore there are 2×4×22=32 ways.
(iii) If two opposing edges have the same color and the rest have the other color, there are 2 ways.
(iv) If two non-opposing edges have the same color and the rest have the other color, there are 4×22=16 ways.
(2) The edges must be colored into blue, yellow or green. There are 3 ways to color a square on the corner if the two squares next to it have the same color, and there are 2 ways if otherwise. Split the cases by how the edges are colored.
(i) Case we use single color on the edges.
(a) If all four edges have the same color, there are 3×34=243 ways.
(ii) Case we use exactly 2 colors.
(a) If exactly three edges have the same color, there are 3×2×4×32×22=864 ways.
(b) If two opposing edges have the same color and the rest have the other color, there are 3×2×24=96 ways.
(c) If two non-opposing edges have the same color and the rest have the other color, there are 3×4×22×32=432 ways.
(iii) Case we use 3 colors.
(a) If two opposing edges have the same color and the rest have different colors, there are 3×2×2×24=192 ways.
(b) If two non-opposing edges have the same color and the rest have different colors, there are 3×4×2×3×23=576 ways.
Consequently, there are 2403×4=9612 ways in total.