The classical Birkhoff ergodic theorem considers a map $T$ acting on a probability space $(X,\mathcal{F},\mu)$. This could alternatively be thought of as an action of $\mathbb{N}$ on $(x,\mathcal{F},\mu)$ by the transformations $T,T^2,T^3,\ldots,T^n,$ et cetera, where $n \in \mathbb{N}$ is identified with the transformation $T^n$. Since at least the 1960s there has been a general effort to extend the Birkhoff theorem to more general groups and semigroups of transformations. A recent high point of this program was a version of the pointwise ergodic theorem due to Lindenstrauss which treats amenable groups of measure-preserving transformations acting on $(X,\mathcal{F},\mu)$. The literature for semigroups of transformations as opposed to groups (since you did not mention whether $T$ and $S$ are invertible) is slightly more sparse but seems to be adequate for your purposes.

In your case, since the transformations commute, you are considering the action of $\mathbb{N}^2$ on $(X,\mathcal{F},\mu)$ given by $(i,j)\mapsto T^iS^j$. For this purpose you could use the results of Bewley ("Extension of the Birkhoff and von Neumann ergodic theorems to semigroup actions",  Ann. Inst. H. Poincaré Sect. B (N.S.) 7 (1971), 283–291) with $G=\mathbb{N}^2$, $\gamma$ being counting measure, and $A_n$ being some sort of rectangle in $\mathbb{N}^2$ containing $(1,1)$. Note that you must be precise about the manner in which $n$ and $m$ separately tend to infinity: to apply Bewley's theorem I think it is sufficient to assume that $n/m$ is bounded away from zero and one.