  Let $X$ be a variety defined over an algebraically closed field $k$ of
characteristic $0$, let $N\in\mathbb{N}$, let $g:X\dashrightarrow X$ be a
dominant rational self-map, and let $A:\mathbb{A}^N\to \mathbb{A}^N$ be a
linear transformation defined over $k(X)$, i.e., for a Zariski open dense
subset $U\subset X$, we have that for $x\in U(k)$, the specialization $A(x)$ is
an $N$-by-$N$ matrix with entries in $k$. We let
$f:X\times\mathbb{A}^N\dashrightarrow X\times \mathbb{A}^N$ be the rational
endomorphism given by $(x,y)\mapsto (g(x), A(x)y)$. We prove that if the
determinant of $A$ is nonzero and if there exists $x\in X(k)$ such that its
orbit $\mathcal{O}_g(x)$ is Zariski dense in $X$, then either there exists a
point $z\in (X\times \mathbb{A}^N)(k)$ such that its orbit $\mathcal{O}_f(z)$
is Zariski dense in $X\times \mathbb{A}^N$ or there exists a nonconstant
rational function $\psi\in k(X\times \mathbb{A}^N)$ such that $\psi\circ
f=\psi$. Our result provides additional evidence to a conjecture of Medvedev
and Scanlon.
