With slightly more general details than in the
original version of André Nicolas's answer, it must be that $Y = aX+b$ where
$$a = \sqrt{\frac{\operatorname{var}(Y)}{\operatorname{var}(X)}}
\quad \text{and}\quad b = E[Y] - aE[X].\tag{1}$$
There is no joint density of $X$ and $Y$ in the sense that $X$ and $Y$ are not jointly
continuous random variables. Thus, to find $E[g(X,Y)]$, simply substitute $aX+b$ for $Y$ and find the expectation of this function of $X$ alone via the law of the unconscious statistician. In other words, $$E[g(X,Y) = E[g(X,aX+b)] = E[h(X)]$$
where $h(x) = g(x,ax+b)$ with $a$ and $b$ are as given in $(1)$.
Note: you say that you know the marginal distributions of $X$ and $Y$ (and
their means and variances). Be aware that the assumption of perfect correlation
with correlation coefficient $+1$ means that it must be that
$$F_Y(z) = F_X\left(\frac{z-b}{a}\right), \quad f_Y(z) = \frac{1}{a}f_X\left(\frac{z-b}{a}\right).\tag{2}$$
If the distributions that are known to you (or given to you) do not satisfy $(2)$, then the problem you are trying to solve has contradictory assumptions, and has no
meaningful answer.