This is an Inclusion-Exclusion problem.
See this article for an
introduction to Inclusion-Exclusion.
Then, see this answer for an explanation of and justification for the Inclusion-Exclusion formula.
First, I will give the corresponding enumeration. Then I will explain it.
The enumeration is
$$4^6 - \left[\binom{4}{1}3^6\right] + \left[\binom{4}{2}2^6\right] - \left[\binom{4}{3}1^6\right] + \left[\binom{4}{4}0^6\right].$$
Let $S$ denote the set of all of the ways that the teachers can be assigned, without any regard to forcing at least one teacher to be assigned to each room.
For $k \in \{1,2,3,4\}$ let $S_k$ denote the subset of $S$ where room $(k)$ has no teacher assigned.
Then, the desired enumeration is
$$|S| - |S_1 \cup S_2 \cup S_3 \cup S_4|.$$
Let $T_0$ denote $|S| \implies T_0 = 4^6.$
That is, there are $(4)$ choices for each teacher.
For $r \in \{1,2,3,4\}$, let $T_r$ denote the $\binom{4}{r}$ terms represented by
$$\sum_{1 \leq i_1 < i_2 < \cdots < i_r \leq 4} ~\left|S_{i_1} \cap \cdots \cap S_{i_r}\right|. \tag1 $$
By considerations of symmetry, each term in the computation of $T_r$ will be equivalent to the computation of
$$|S_1 \cap \cdots \cap S_r|. \tag2 $$
In (2) above, such a computation represents that there are $(4-r)$ choices for each teacher.
Therefore,
$\displaystyle T_r = \binom{4}{r} (4-r)^6.$
Per Inclusion-Exclusion theory, the desired computation is
$\displaystyle \sum_{r=0}^4 (-1)^r T_r.$