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?