use four different colors to color the four rectangles A, B, C, and D as shown in the figure. No two rectangles sharing the same edge can be the same color. How many ways are there to color the rectangles?

Here's my best effort

We have 4 ways to color A, 3 ways to color B, 2 ways to color C and one way to color D

So.....the the total ways to color the rectangles = 4 * 3 * 2 * 1 = 4! = 24 ways