Let $X$ and $Y$ be random variables and $Y=g(X)$. I then drawn $n$ random samples X to get the set $\{x_1, x_2, ..., x_n\}$ according to the CDF of $X$ called $F_X(x)$. I process each sample as $y_i=g(x_i) \forall i \in \{1,2,...,n\}$ to get $\{y_1, y_2, ..., y_n\}$.
My question is this: how do I know that $\{y_1, y_2, ..., y_n\}$ is a random sample of $Y$ according to the CDF of $Y$ called $F_Y(y)$? Is there a theorem that proves this property? This appears to be a fundamental assumption of the Monte Carlo method, but I'm struggling to find it explicitly identified anywhere.