Let $\varphi:\mathbb R^n \to \mathbb R^n$ be just some continuous function.
If the image of $\varphi$ happens to contain $\mathbb Q^n$, does it follow that in fact all of $\mathbb R^n$ is contained in the image as well?
No, it does not. For instance, the map given by $$(x,y)\overset{\varphi}{\longmapsto} (xy-1+\pi, x^2(xy-1)+y)$$ has as its image every point in $\mathbb R^2$ except for $(\pi,0)$.
But now suppose instead that $\mathbb Q^n$ is actually contained in the image of just $\mathbb Q^n$. That is, instead of requiring only that $$\mathbb Q^n \subseteq \varphi[\mathbb R^n]\phantom{.}$$ we require that in fact $$\mathbb Q^n \subseteq \varphi[\mathbb Q^n].$$
Question. Does it then follow that $\varphi[\mathbb R^n]=\mathbb R^n$, or is there a counterexample?