# Generalised change of variables
$\newcommand{\dr}{\mathrm{d}}
\newcommand{\set}[1]{\mathcal{#1}}
\newcommand{\vct}[1]{\boldsymbol{#1}}
\newcommand{\rvar}[1]{\mathsf{#1}}
\newcommand{\rvct}[1]{\boldsymbol{\mathsf{#1}}}
\newcommand{\mtx}[1]{\mathbf{#1}}
\newcommand{\op}[1]{\boldsymbol{#1}}
\newcommand{\nrm}[1]{\mathcal{N}\left( #1 \right)}
\newcommand{\pden}[1]{\mathsf{p}_{#1}}
\newcommand{\prob}[1]{\mathsf{P}_{#1}}
\newcommand{\gvn}{\,|\,}
\newcommand{\dr}{\mathrm{d}}
\newcommand{\tr}{^{\mkern-1.5mu\mathsf{T}}}
\newcommand{\td}[2]{\frac{\dr #1}{\dr #2}}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pdd}[3]{\frac{\partial^2 #1}{\partial #2\,\partial #3}}
\newcommand{\reals}{\mathbb{R}}
\newcommand{\jacob}[2]{\mathbf{J}_{#1}(#2)}$
Let $\rvct{v}$ be a $\reals^M$-valued random vector and $\rvct{w}$ be a $\reals^N$-valued random vector and $\vct{h} : \reals^M \to \reals^N$ a measurable Lipschitz function, with $\rvct{w} = \vct{h}(\rvct{v})$.
If we assume that $\rvct{v}$ is distributed with density $p_\rvct{v} : \reals^M \to [0,\infty)$ with respect to the $M$ dimensional Lebesgue measure, then if the Jacobian $\jacob{\vct{h}}{\vct{v}} = \pd{\vct{h}}{\vct{v}}$ exists and has full row rank almost everywhere (for which a necessary condition is $M \geq N$) then $\rvct{w}$ is distributed with a density $p_{\rvct{w}} : \reals^N \to [0\,\infty)$ with respect to the $N$ dimensional Lebesgue measure which satisfies
$$
p_{\rvct{w}}(\vct{w}) =
\begin{cases}
\displaystyle
\int_{\vct{h}^{-1}[\lbrace \vct{w}\rbrace]}
p_{\rvct{v}}(\vct{v})\,
\left| \jacob{\vct{h}}{\vct{v}} \, \jacob{\vct{h}}{\vct{v}}\tr\right|^{-\frac{1}{2}}
\sigma^{M-N}(\dr \vct{v})
&\quad
\forall \vct{w} \in \vct{h}[\set{V}]\\
0 & \quad \forall \vct{w} \notin \vct{h}[\set{V}]
\end{cases}
$$
Here $\vct{h}[\cdot]$ indicates the image of a set under $\vct{h}$ and $\vct{h}^{-1}[\cdot]$ the preimage under $\vct{h}$ and $\sigma^{M-N}$ the $M-N$ dimensional Hausdorff (or area) measure. For $M > N$ and smooth $\vct{h}$, the preimage $\vct{h}^{-1}[\lbrace \vct{w}\rbrace]$, i.e. the set of points in $\reals^M$ which $\vct{h}$ maps to $\vct{w}$, will be a smooth manifold. For the case $M = N$, $\vct{h}^{-1}(\vct{w})$ will be a finite set of discrete points and the zero-dimensional Hausdorff measure corresponds to the counting measure on this set and so
$$
p_{\rvct{w}}(\vct{w}) =
\sum_{\vct{v} \in \vct{h}^{-1}[\lbrace \vct{w}\rbrace]}
p_{\rvct{v}}(\vct{v})\,
\left| \jacob{\vct{h}}{\vct{v}} \, \jacob{\vct{h}}{\vct{v}}\tr\right|^{-\frac{1}{2}} =
\sum_{\vct{v} \in \vct{h}^{-1}[\lbrace \vct{w}\rbrace]}
p_{\rvct{v}}(\vct{v})\,
\left| \jacob{\vct{h}}{\vct{v}}\right|^{-1}
\quad
\forall \vct{w} \in \vct{h}[\set{V}]
$$
If we additionally have that $\vct{h}$ is injective (one-to-one) then the preimages of all $\vct{w} \in \vct{h}[\set{V}]$ under $\vct{h}$ are singleton sets and denoting $\vct{h}^{-1}(\cdot)$ as the corresponding inverse function we have
\begin{align}
p_{\rvct{w}}(\vct{w}) &=
p_{\rvct{v}}(\vct{h}^{-1}(\vct{w}))\,
\left| \jacob{\vct{h}}{\vct{h}^{-1}(\vct{w})}\right|^{-1}
\quad
&\forall \vct{w} \in \vct{h}[\set{V}]\\
\iff
p_{\rvct{v}}(\vct{v}) &=
p_{\rvct{w}}(\vct{h}(\vct{v}))\,
\left| \jacob{\vct{h}}{\vct{v}}\right|
\quad
&\forall \vct{v} \in \set{V}
\end{align}
which corresponds to the standard change of variables formula for invertible transformations.