Patching together homeomorphisms: how badly can it fail? Suppose we have a set $X$ with $X=U \cup V$. If we pick a permutation $f$ of $U$ and a permutation $g$ of $V$ which agree on the intersection $U \cap V$, we can coalesce them into one big endo-map $F$ of $X$. In general, of course, $F$ is no longer a permutation - we can only say that it is onto. A counter-example is fun to think of - for example, if $X$ is finite, then $F$ is always a permutation.
Now let $X, U$  and $V$ be open subsets of $\Bbb{R}^n$, and suppose $f$ and $g$ are smooth homeomorphisms. I have been unable to come up with a single example for which the above patching fails "badly", say for which the set of points $x$ having more than one pre-image had positive measure. 
I'd love to know if anyone knows anything related to this problem, or could provide a counter-example. Thank you!
 A: If you allow the open sets $X$, $U$ and $V$ to be disconnected, you get a counter-example by taking a countable example and changing points to pairwise disjoint balls.
Edit 2: Here is a modified version of Joel's example, which was later deleted. Define $U$ to be the open set inside the green rectangle and $V$ to be the open set inside the red rectangle. Just for notation, suppose that the left-bottom corner is $(0,0)$ and that the width of the "house" is $1$.
Define $f \colon U \to U$ be a mapping $$(x,y) \mapsto \left(\frac12x,y\right)$$ on the part of $U$ which does not include the "chimney", i.e. the top left box. Correspondingly, the part of the mapping $g \colon V \to V$ which maps everything but the chimney is defined as $$(x,y) \mapsto \left(\frac12(x+1),y\right).$$ The chimneys are then mapped with homoemorphisms to the missing parts of $U$ and $V$.
Now the set $U \cap V$ is the middle part of the house. The set inside the yellow rectangle has two pre-images and has positive area.

Remark: This example does not differ that much from the first one which I posted. Essentially we just extend the mappings defined on the balls slightly (and rearrange the balls if this is not possible otherwise) to make the sets $U$ and $V$ connected.
A: The set of points having more than one pre-image is open (so it always has positive measure if it is non-empty). It follows that $U \cap V$ must be disconnected and in fact it has to have infinitely many connected components. However there are examples in $\mathbb{R}^2$ where both $U$ and $V$ are connected:
For a negative integer $n$ we define the real intervals $$I_n=(2n-\frac{1}{3},2n+\frac{1}{3}) \mbox{ ;  } J_n=(2n+\frac{2}{3},2n+\frac{4}{3}).$$ For a non-negative integer $n$ we let $$I_n=J_n=(n-\frac{1}{3},n+\frac{1}{3}).$$ 
Let $f$ and $g$ be two increasing (smooth if you wish) homeomorphisms from $\mathbb{R}$ onto $\mathbb{R}$ such that $f[I_n]=I_{n+1}$ and $g[J_n]=J_{n+1}$ for all $n \in \mathbb{Z}$. Let $I=\bigcup_{n\in \mathbb{Z}}I_n$ and $J=\bigcup_{n\in \mathbb{Z}}J_n$. 
Now in $\mathbb{R}^2$ we define the open sets $$U=I \times (-1, \infty) \cup \mathbb{R} \times (2,\infty)$$ $$V=J \times (-\infty, 1) \cup \mathbb{R} \times (-\infty ,-2).$$ 
Finally we let $F=f \times id$ and $G=g \times id$ be the autohomeomorphisms of $U$ and $V$ respectively. The set of points with two pre-images is precisely $I_0 \times (-1,1)$.
Similar examples exist in $\mathbb{R}^n$ for $n\geq3$, but of course in $\mathbb{R}$ we cannot get $U,V$ to be connected.
