To fine-tune figures with many panels etc., or also beamer slides, it would sometimes come in handy to quickly see the outlines of minipages, graphics, etc. This can be achieved by manually wrapping the respective objects in \fbox{} or -- in beamer -- \frame{} commands. However, that's tedious.
I imagine the simplest solution would be to redefine minipage, includegraphics, subfigure, etc. in the header such that they are placed in an \fbox{} and thus are framed throughout the document. These redefinitions could then simply be uncommented whenever frames are desired. Of course, all options etc. should still be supported. How can this be achieved?
Following is an example with two figures, first the original, then with manual fboxes. The goal is that with redefined commands, the first figure looks like the second.
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
% Remove padding from fbox
\setlength{\fboxsep}{0pt}
\newlength{\h}
\begin{document}
\setlength{\h}{0.5\linewidth}
\begin{figure}\centering
%
\begin{subfigure}[t]{0.02\linewidth}
\rotatebox{90}{\begin{minipage}{\h}\centering\textbf{first row}\end{minipage}}\\
\rotatebox{90}{\begin{minipage}{\h}\centering\textbf{first row}\end{minipage}}
\end{subfigure}
%
\begin{subfigure}[t]{0.45\linewidth}\centering
\includegraphics[width=2in]{example-image}\\
\includegraphics[width=2in]{example-image}
\caption*{\textbf{first column}}
\end{subfigure}
\hfill
%
\begin{subfigure}[t]{0.45\linewidth}\centering
\includegraphics[width=2in]{example-image}\\
\includegraphics[width=2in]{example-image}
\caption*{\textbf{second column}}
\end{subfigure}
%
\caption{\ldots}
\end{figure}
\begin{figure}\centering
%
\fbox{
\begin{subfigure}[t]{0.02\linewidth}
\rotatebox{90}{\fbox{\begin{minipage}{\h}\centering\textbf{first row}\end{minipage}}}\\
\rotatebox{90}{\fbox{\begin{minipage}{\h}\centering\textbf{second row}\end{minipage}}}
\end{subfigure}
}
%
\fbox{
\begin{subfigure}[t]{0.45\linewidth}\centering
\fbox{\includegraphics[height=\h]{example-image}}\\
\fbox{\includegraphics[height=\h]{example-image}}
\caption*{\textbf{first column}}
\end{subfigure}
}
\hfill
%
\fbox{
\begin{subfigure}[t]{0.45\linewidth}\centering
\fbox{\includegraphics[height=\h]{example-image}}\\
\fbox{\includegraphics[height=\h]{example-image}}
\caption*{\textbf{second column}}
\end{subfigure}
}
%
\caption{\ldots}
\end{figure}
\end{document}
Edit:
The solution for \includegraphics is as follows (thanks @Skillmon for pointing me to it):
\let\includegraphicsbak\includegraphics
\renewcommand*{\includegraphics}[2][]{\fbox{\includegraphicsbak[#1]{#2}}}
How can the same be achieved for command blocks (minipage, subfigure)?

\includegraphics. – Skillmon Jul 04 '17 at 12:24example-image,example-image-aorexample-image-bfor the images in your MWEs. Those are installed with themwe-package (included in both TeXLive and MikTeX) and therefore installed on close to every PC running LaTeX. (I've edited your question changing that) – Skillmon Jul 04 '17 at 12:31mweis not installed). – flotzilla Jul 04 '17 at 12:35\usepackage[export]{adjustbox}shouldn't be necessary if you use the\fbox{\includegraphicsbak...}-approach. – Skillmon Jul 04 '17 at 12:42\fboxsep=-\fboxrule(just inside the environments and commands you want to alter), as this way it shouldn't add any extra space. – Skillmon Jul 04 '17 at 14:57