I'm using TikZ pictures to represent terms in an equation, and I want to visually group some of these terms by drawing a rectangle behind them. But each term is its own separate picture, which means I can't just draw the rectangle on a background layer. Is there some way I can make the rectangle appear behind the equation, despite not knowing where to draw the rectangle in advance?
The following example demonstrates the best I can do on my own, namely having the rectangle appear in front of the equation. I've edited the example from the previous version of the question to make it more realistic, because it affects the usability of some of the suggested solutions. (Sorry! My MWE was too minimal at first.)

Code:
\documentclass[b3paper]{baposter}
\usepackage{tikz,amsmath}
\usetikzlibrary{fit}
\begin{document}
\begin{poster}{bgColorOne=blue!20!white,background=plain}{}{}{}{}
\begin{posterbox}[textborder=none,headerborder=none,span=3,boxColorOne=white]{title}
\begin{align}
x &=
\begin{tikzpicture}[remember picture]
\node[circle,fill=red,minimum width=1cm] {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=cyan,minimum width=1cm] (first node) {};
\end{tikzpicture}
\\
y &=
\begin{tikzpicture}[remember picture]
\node[circle,fill=red,minimum width=1cm] {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=cyan,minimum width=1cm] (second node) {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=green,minimum width=1cm] (third node) {};
\end{tikzpicture}
\end{align}
\begin{tikzpicture}[remember picture,overlay]
\node[draw=red,fill=yellow,fill opacity=0.8,fit=(first node) (second node) (third node),rectangle] {};
\end{tikzpicture}
\end{posterbox}
\end{poster}
\end{document}
It's a little tricky because
- the pictures I want to highlight are not contiguous in the source, and
- there is an existing background which I have to draw over, so it's really a matter of sticking a picture between two existing "layers" of the document.



baseline=-1exto your first twotikzpictures to get nicer baseline alignment. – bencarabelli Mar 18 '13 at 13:29