Assume $f:X\to Y$ is a morphism of schemes and take $U_1,U_2$ open subsets of $X$ s.t. $f(U_i)\subset V$ for some open subset $V\subset Y$. I would like to show the induced map $U_1\times_V U_2\to X\times_Y X $ is an open immersion.
I think I have an idea on how to prove the statement, but I'm not sure it works. The situation can be represented diagrammatically as a cube where two faces of the cubes are pullbacks : 
Essentially, you have two (pullback) squares
$\require{AMScd}$ \begin{CD} U_1\times_V U_2 @>>> U_1 @. X\times_Y X @>>> X\\ @VVV @VVV @VVV @VVV \\ U_2 @>>> V @. X@>>> Y \end{CD}
And you have maps between the squares making the whole cube commutes, given by the inclusions $U_i\to X$, $V\to Y$ and the induced map $U_1\times_V U_2 \to X\times_YX$. My reasoning was that since each map $U_i\to X$ and $V\to Y$ is an open immersion, and open immersions are stable under base change, surely the resulting map $U_1\times_V U_2 \to X\times_YX$ is also an open immersion. But while I can prove these two separate facts, I cannot actually reach the desired conclusion. I also feel I might be able to arrive at the desired conclusion using associativity of pullbacs in a way but I don't know. Any help is appreciated.