A magic square is a square with side 3 consisting of 9 unit squares, such that the numbers written in the unit squares (one number in each square) satisfy the following property: the sum of the numbers in each row is equal to the sum of the numbers in each column and is equal to the sum of all the numbers written in any of the two diagonals.

A rectangle with sides $m\ge3$ and $n\ge3$ consists of $mn$ unit squares. If in each of those unit squares exactly one number is written, such that any square with side $3$ is a magic square, then find the number of most different numbers that can be written in that rectangle.
1. **Understanding the Problem:**
   We need to find the maximum number of different numbers that can be written in an \(m \times n\) rectangle such that any \(3 \times 3\) sub-square is a magic square. A magic square is defined such that the sum of the numbers in each row, each column, and both diagonals are equal.

2. **Case \(m = n = 3\):**
   For a \(3 \times 3\) magic square, it is well-known that there are 9 different numbers that can be used. This is because a \(3 \times 3\) magic square has a unique arrangement of numbers from 1 to 9 that satisfies the magic square properties.

3. **Case \(m > 3\) or \(n > 3\):**
   For larger rectangles, we need to ensure that every \(3 \times 3\) sub-square is a magic square. Let's assume \(m \geq 4\) and \(n \geq 4\) for generality.

4. **Assumption and Simplification:**
   Assume without loss of generality that the number in the top-left corner of the rectangle is 0. This is possible because we can subtract a constant from every unit square without changing the magic square property.

5. **Setting Up the Equations:**
   Let the numbers in the first \(3 \times 3\) sub-square be:
   \[
   \begin{array}{ccc}
   0 & x & y \\
   z & w & t \\
   u & v & s \\
   \end{array}
   \]
   The magic square conditions give us the following equations:
   \[
   \begin{aligned}
   0 + x + y &= z + w + t = u + v + s, \\
   0 + z + u &= x + w + v = y + t + s, \\
   0 + w + s &= y + w + u.
   \end{aligned}
   \]

6. **Solving the Equations:**
   From the equations, we can derive that:
   \[
   \begin{aligned}
   x + y &= z + w + t - 0, \\
   z + u &= x + w + v - 0, \\
   w + s &= y + w + u - 0.
   \end{aligned}
   \]
   By solving these equations, we find that all variables must be equal to maintain the magic square property across the entire rectangle.

7. **Conclusion for Larger Rectangles:**
   If \(m > 3\) or \(n > 3\), the only way to satisfy the condition that every \(3 \times 3\) sub-square is a magic square is if all numbers in the rectangle are the same. This is because any deviation would violate the magic square property in overlapping \(3 \times 3\) sub-squares.

8. **Final Answer:**
   For \(m = n = 3\), the maximum number of different numbers is 9. For \(m > 3\) or \(n > 3\), the maximum number of different numbers is 1.

The final answer is \( \boxed{ 9 } \) for \(m = n = 3\) and \(1\) for \(m > 3\) or \(n > 3\).