You are able to put numbers standing by each vertical and horizontal line of the chessboard. Just like what I am doing below,

[HTML]

1 2 3

--- ---

| | |

2 --- ---

| | |

3 --- ---

[/HTML]

Then I can say for the longer border of rectangle, I have 3 pairs of start and end points, since picking up 2 numbers from 3 numbers has 3 possibilities, they are 12, 13, 23.

Similarly, I also have 3 choices when facing the situation of the shorter border of the rectangle. The possible combinations are 12, 13, 23.

So, for the rectangle permutation, I have 9 choices, they are 12-12, 12-13, 12-23, 13-12, 13-13, 13-23, 23-12, 23-13, 23-23. They are exactly the answers to your example question.

For general cases, just think about it in the same way, then you may come to the conclusion that

[HTML]

-- 2 -- 2 m! n!

Answer = | x | = ------------------------

-- m -- n 2！ 2！ (m-2)! (n-2)!

[/HTML]