There are many such constructions. Here is a sketch of one of them:
${\bf Lemma.}$ If $\phi:\quad [t_0,t_1]\to[a,a+h]\times[b,b+h], \quad t\mapsto \Bigl(a+{t-t_0\over t_1-t_0}h,b+{t-t_0\over t_1-t_0}h\Bigr)\qquad(t_0\leq t\leq t_1)$ is a parametric representation of the diagonal of the square $Q:=[a_0,a_0+h]\times[b_0,b_0+h]$ then one can find a piecewise linear function \phi':\quad [t_0,t_1]\to[a,a+h]\times[b,b+h]\qquad(t_0\leq t\leq t_1) such that \phi'(t_0)=(a,b) and \phi'(t_1)=(a+h,b+h) and such that \phi' traces nine diagonals of the nine equal squares Q' partitioning $Q$ in turn. (Replace $h$ by $-h$ where necessary.) It follows that |\phi'(t)-\phi(t)|\leq \sqrt{2}|h|\qquad(t_0\leq t\leq t_1)\ . Starting with $\phi_0:\quad[0,1]\to Q_0:=[0,1]^2,\quad \quad t \mapsto (t,t)\qquad(0\leq t\leq 1)$ one constructs a sequence of maps $\phi_n:\quad[0,1]\to Q_0$ as follows: To obtain $\phi_{n+1}$ from $\phi_n$, each diagonal segment of $\phi_n$ is replaced by nine diagonal segments in the manner described above.
Using the estimate $(*)$ one proves that the $\phi_n$ converge uniformly to a limit function $\phi:[0,1]\to Q_0$. As each $\phi_n$ visits all points of the form $(j/3^n,k/3^n)$ in $Q_0$, it is easy to see that $\phi\bigl([0,1]\bigr)$ is dense in $Q_0$, and as $\phi\bigl([0,1]\bigr)$ is compact it has to be all of $Q_0$.