How to shift an object to rest on the xy-plane? For example, I have a cube, which exists somewhere in 3-space, that is composed of edge vectors and vertex points. How can I shift these values so that a face of the cube rests on the xy-plane?
I don't want all the vectors to simply be projected onto the xy-plane, since they should retain their magnitude. The cube should appear exactly the same, other than a change in orientation and position.
How can I define a transformation matrix or value to signify how to rotate the top-left cube so that the blue-outlined face is coplanar with the xy-plane (like the bottom-right cube)?

 A: Yes. You can do this with a translation and a rotation. 
Let's start by saying that one of the corners of the blue square that you want to move to the plane is called $A$: then you take all the corners of your cube and subtract $A$ from them, so that $A$ becomes $(0,0,0)$, and the other corners become...some other points. This is "translation" and doesn't change the shape of the cube at all. 
Now let's suppose that the two corners of your blue square adjacent to $A$ are called $B$ and $C$, and the third corner adjacent to $A$ (the not-blue one) is called $D$. Compute
$$
u = B - A\\
v = C - A \\
w = D - A
$$
each of these is to be computed term-by-term, so if $B = (4, 6, 3)$ and $A = (2, 0, 1)$, then $u = (2, 6, 2)$, ok? If you use post-translation vertex coordinates, then $A = (0,0,0)$, so $u = B - A$ will contain just the (post-translation) coordinates of $B$. It doesn't matter which you use -- you'll get the same value for $u$. 
Now, you're going to alter $u, v, w$ slightly:


*

*compute $L = \sqrt{u_x^2 + u_y^2 + u_z^2}$

*replace $u = (u_x, u_y, u_z)$ with $u = (\frac{u_x}{L}, \frac{u_y}{L}, \frac{u_z}{L})$, i.e., divide each coordinate by $L$. 


Do a similar operation to $v$ and $w$. 
Now you're going to do the following transformation to each $(x,y,z)$ point of the post-translation cube (i.e., each vertex, or each point on any face, whatever).
\begin{align}
(x, y, z) &\mapsto (x', y', z'), \text{where}\\
x' &= u_x x + u_y y + u_z z\\
y' &= v_x x + v_y y + v_z z\\
z' &= w_x x + w_y y + w_z z.
\end{align}
That will send the edge $AB$ to the positive x-axis, the edge $AC$ to the positive $y$ axis, and the edge $AD$ to the positive z-axis. 
If you actually know about matrices and linear algebra, this is all a good deal easier: the transformation (using homogeneous coordinates like $(a_x, a_y, a_z, 1)$ for the point $A$), looks  like
$$
X \mapsto \mathbf M X
$$
where 
$\mathbf M$ is a matrix whose upper right $3 \times 1$ submatrix contains $-a_x, -a_y, -a_z$. The lower right entry is 1; the bottom left $1 \times 1$ submatrix is all zeroes, i.e., it looks like
$$
\mathbf M = \begin{bmatrix} 
 &   & & -a_x \\
 & * & & -a_y \\
 &   & & -a_z \\
 0&  0  & 0 & 1 \\
\end{bmatrix}.
$$
The upper left $3 \times 3$ block has rows $u', v', w'$, where 
\begin{align}
u' = \frac{B - A}{\| B - A \|} \\
v' = \frac{C - A}{\| C - A \|} \\
w' = \frac{D - A}{\| D - A \|}.
\end{align}
And that's it. In this form, the letters $A$, $B$, $C$, and $D$ denot the coordinates of the specified vertices before any operations have taken place. 
Addition in response to comments
This works because the vectors $u,v,w$ are pairwise perpendicular, so that inverting a particular matrix amounts to just transposing it. 
In general, if you have a basepoint ($A$) and a point $B$ that you want on the $x$-axis, and a point $C$ that you want in the +y halfplane, you can compute
$$
u = B - A\\
v = C - A
$$
Then you let 
$$
\hat{v} = v - \frac{ (u \cdot v) u}{u \cdot u}
$$
to make $v$ and $u$ perpendicular, and then let
$$
u' = u / \| u \|\\
v' = \hat{v} / \| \hat{v} \|
w' = u' \times v'
$$
Now once again, these are pairwise orthogonal unit vectors, and the matrix described above will do what you need. 
A: What is needed to map the blue square to the xy-plane is an affine transformation (translation + linear transformation). We will basically rotate one Cartesian coordinate system onto the standard Cartesian coordinate system, and then translate the rotated blue square to the origin. We first define a coordinate system with two coordinate vectors in the plane of the blue square. Let $A$ be a corner of the blue square, $B$ and $C$ adjacent corners to $A$ on the blue square, and $D$ a corner of the cube adjacent to A but not on the blue square. An intuitive Cartesian coordinate system for the cube would then be
\begin{align}
\hat{u} &= \frac{B-A}{||B-A||} \\
\hat{v} &= \frac{C-A}{||C-A||} \\
\hat{w} &= \frac{D-A}{||D-A||}
\end{align}
An affine transformation takes the form
\begin{equation}
\begin{bmatrix} \vec{y} \\ 1 \end{bmatrix} = M \begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}
\end{equation}
where $M$ is the affine transformation matrix and the points have been put it homogeneous coordinates (in homogeneous coordinates, points get 1's appended to them and vectors get 0's appended). The $M$ that maps one coordinate system $(\hat{u},\hat{v},\hat{w})$ with origin $\vec{o}_u$ to another $(\hat{x},\hat{y},\hat{z})$ with origin $\vec{o}_x$ takes the form
\begin{equation}
\begin{bmatrix} \hat{x}& \hat{y} & \hat{z} & \vec{o}_x \\ 0&0&0&1 \end{bmatrix} = M\begin{bmatrix} \hat{u}& \hat{v} & \hat{w} & \vec{o}_u \\ 0&0&0&1 \end{bmatrix}
\end{equation}
\begin{equation}
\implies M = \begin{bmatrix} \hat{x}& \hat{y} & \hat{z} & \vec{o}_x \\ 0&0&0&1 \end{bmatrix} \begin{bmatrix} \hat{u}& \hat{v} & \hat{w} & \vec{o}_u \\ 0&0&0&1 \end{bmatrix}^{-1}
\end{equation}
As an example, let the points of the blue square be $(0.5, -0.5, 0.5)$, $(0.5, -0.5, -0.5)$, $(-0.5, -0.5, -0.5)$, and $(-0.5, -0.5, 0.5)$, then
\begin{align}
a &= (0.5, -0.5, 0.5) \\
b &= (0.5, -0.5, -0.5) \\
c &= (-0.5,-0.5,0.5) \\
d &= (0.5, 0.5, 0.5)
\end{align}
\begin{align}
\hat{u} &= (0, 0, -1) \\
\hat{v} &= (-1, 0, 0) \\
\hat{w} &= (0,1,0) \\
\vec{o}_u &= \vec{a} = (0.5, -0.5, 0.5)
\end{align}
\begin{equation}
M = \begin{pmatrix} 0 & 0 & -1 & 0.5 \\ -1 & 0 & 0 & 0.5 \\ 0 & 1 & 0 & 0.5 \\ 0 & 0 & 0 & 1  \end{pmatrix}
\end{equation}
Another approach that doesn't depend on an affine transformation or homogeneous coordinates relies on dyadics or vector outer products. Once the blue square is translated such that it passes through the origin (subtract $a$ from all corners), the rotation matrix that rotates the translated blue square onto the xy-plane is given by the vector outer product
\begin{equation}
R = \hat{u} \, \hat{x}^\top + \hat{v}\, \hat{y}^\top + \hat{w}\, \hat{z}^\top,
\end{equation}
which for the example above is
\begin{equation}
R = \begin{pmatrix} 0 & 0 & -1 \\ -1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}.
\end{equation}
Because we are mapping to the standard Cartesian basis, the rows of $R$ are simply $\hat{u}$, $\hat{v}$, and $\hat{w}$.
You will notice that $R$ is just the top left $3\times3$ submatrix of $M$, and the last column of $M$ is not $-\vec{a}$ in homogeneous coordinates. The reason the last column of $M$ is not $-\vec{a}$ is because matrix multiplication is not commutative. When we calculate $\begin{bmatrix} \vec{y} \\ 1 \end{bmatrix} = M \begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}$ the matrix $M$ first rotates $\begin{bmatrix} \vec{x} \\ 1 \end{bmatrix}$ and then translates it, so the last column of $M$ is simply $-R \vec{a}$ in homogeneous coordinates.
