Non-invertible measure preserving transformations of $\mathbb{R}^n$ I am looking for particular examples of measure-preserving transformations of $\mathbb{R}^n$ (with Lebesgue measure) to get a better idea of how they behave.
A large family of such transformations are the diffeomorphisms whose derivative has determinant $\pm 1$ everywhere. 
There are also non-continuous examples like the map $x \mapsto x - 1/x$ on $\mathbb{R}$.
However, all the continuous measure-preserving maps that I know of are in fact homeomorphisms. I was wondering how far from a homeomorphism can a continuous measure-preserving map be, but I don't have any examples on my mind. So my question is:

What are examples of continuous measure-preserving maps of $\mathbb{R}^n$ that are not homeomorphisms?

Here are some thoughts:
Such a map must be "almost-surjective", in the sense that its image has full measure. Indeed, the preimage of the complement of the image is empty, so it must have measure $0$ since the map is measure-preserving.
Also, the map cannot be excessively non-injective since the preimage of a point must have measure $0$. I was wondering if there was some stronger statement we could say about injectivity (like we have for surjectivity).
 A: This is a very partial answer. I think I have found an example in dimension 1.
Consider the following function:
$$
f(x) =  
\begin{cases} 
x &\text{if} \quad x < 0 \\
3x &\text{if} \quad 0 \leq x \leq 1 \\
|3x-6| &\text{if} \quad 1 < x \leq 3 \\
x &\text{if} \quad x>3
\end{cases}
$$
The graph is more illuminating:

So $f$ is the identity everywhere except on $[0,3]$, where its slope is $3$ times higher to compensate for the fact  that every point in $[0,3]$ will have $3$ preimages.
To prove $f$ is measure-preserving, it suffices to check that it preserves the measure of open intervals. For intervals that do not intersect $[0,3]$, this is immediate. For intervals $(a,b) \subset [0,3]$, the preimage is a union of $3$ disjoint intervals of length $1/3(b-a)$:
$$
f^{-1}((a,b)) = \left(\frac{a}{3}, \frac{b}{3}\right) 
\cup \left(-\frac{a}{3}+2, -\frac{b}{3}+2 \right) 
\cup \left(\frac{a}{3}+2, \frac{b}{3}+2 \right)
$$
So we have $\mu( f^{-1}((a,b)) ) = b-a = \mu((a,b))$.
We are done since for an arbitrary open interval $I$ we can write $I = (I \cap [0,3]) \cup (I \cap [0,3]^c)$ and then 
\begin{align}
\mu( f^{-1}(I) ) &= \mu(f^{-1}((I \cap [0,3]) \cup (I \cap [0,3]^c))) \\
&= \mu(f^{-1}(I \cap [0,3])) +\mu(f^{-1} (I \cap [0,3]^c)) \\
&= \mu(I \cap [0,3]) + \mu( I \cap [0,3]^c) \\
&= \mu (I)
\end{align}
So $f$ is a continuous and surjective measure-preserving transformation, though it is not injective. It is easy to see that we could construct other examples by adding more "teeth" to the function and adjusting the slope to compensate. 
A: Here's another partial answer but broad enough to contain a fairly large class of maps.
Consider a locally Lipchitz map $f:\Bbb R \to \Bbb R$ such that the set of points at which $f$ achieves its local maxima and minima is locally finite. From my own observation it seems that for $f$ to be measure preserving, it needs to satisfy the following condition:
If $a \in \Bbb R$ is not a (local) extreme value of $f$, then one should have $$ \sum_{x \in f^{-1}(\{a\})} \frac{1}{|f'(x)|} = 1.$$
On the other hand, if $a$ is a local extreme value of $f$, then the same thing should hold but we need to replace $\frac1{|f'(x)|}$ with $\frac1{|f'(x+)|} + \frac1{|f'(x-)|}$ for every point $x \in f^{-1}(a)$ at which $f$ achieves a local max or min.
All examples of measure preserving transformations that I can think of (e.g. the function from Glasser's master theorem or the function from the other answer) seem to satisfy this condition, so it seems to be an if and only if condition (with some modification for functions with a locally finite set of discontinuities). 
In particular such maps cannot be globally $C^1$ unless they are the identity map, because the given condition implies that $|f'(x)| \ge 1$ for all $x$. I don't know what happens on $\Bbb R^n$ for $n>1$; perhaps there's a generalization.
