I'm trying to find conditions on the gluing map between two manifolds so that the quotient space will be a smooth manifold, and the inclusion map will be a diffeomorphism. Specifically,
Suppose $U_j$ is an open subset of a smooth $m$-manifold $M_j$, for $j \in \{1,2\}$, and $h: U_1 \to U_2$ is a diffeomorphism. Let $\sim$ be the smallest equivalence relation on the disjoint union $M_1 \sqcup M_2$ such that $u \sim h(u)$ for all $u\in U_1$. Let $\bar{M} = (M_1 \sqcup M_2) / \sim$, define $\pi:M_1\sqcup M_2 \to \bar{M}$ to be the quotient map, and equip $\bar{M}$ with the quotient topology. Find conditions on $h$ such that $\bar{M}$ admits the structure of a smooth $m$-manifold such that
$$\pi|_{M_j}: (M_1 \sqcup M_2) \supset M_j \to \pi(M_j) \subset \bar{M}$$
is a diffeomorphism onto an open set of $\bar{M}$ for $i\in \{1,2\}$.
My attempt so far: If $\{A_i, \phi_i \}$ is an atlas for $M_1$ and $\{B_j, \psi_j\}$ is an atlas for $M_2$, I'm looking for a natural way to define an atlas $C_k, \zeta_k$ on $\bar{M}$. If I can find that, then I need to show that
$$\zeta_k \circ \pi_{M_1} \circ \phi_i^{-1}$$
is a diffeomorphism for all $A_i$. $h$, I'm thinking, should somehow be compatible with the charts $\phi_i, \psi_j$ on $A_i \cap U_1$ and $B_j \cap U_2$. But here I'm kind of stuck. Any ideas?
The issue is what will happen at the boundaries of $U_j$. Let $x$ be a boundary point of $U_1$. If there is a sequence $p_j$ in $U$ such that $p_j\to x$ and $h(p_j)$ have a limit $y\in M_2$, then the quotient will not be a Hausdorff space: $x$ and $y$ do not have disjoint neighborhoods.
Therefore, $h$ must be such that the above does not happen. Here is a way to formalize this: every point $x\in \partial U_1$ must have a neighborhood $V$ in $M_1$ such that the closure of $h(V\cap U_1)$ in $M_2$ is contained in $U_2$. And conversely, with $1$ and $2$ interchanged.
Now you should be able to show that the image of $V$ in the quotient is homeomorphic to $V$. In particular, the quotient is a locally Euclidean space (topological manifold). As for smoothness, the charts you have on $M_1$ will work also on the quotient.
It may help to first work out a concrete example: intervals $(0,2)$ and $(5,7)$ glued along $h(x)=x+4$, where $U_1=(1,2)$ and $U_2=(5,6)$.