# Align block with margin

I am using beamer with the inner theme rectangles. The text inside blocks is then aligned with the text outside of the blocks, and the edge of the blocks stick out into the margins. I would like the block edges to follow the margins. I searched for a solution, and the best I found was placing the block environment inside a minipage of the desired width and place this inside center.

I tried this, and it is roughly aligned on the left. However, now there is more white space on the right side of the block than on the left.

\documentclass{beamer}

\usepackage{etoolbox}

\useinnertheme{rectangles}

\setbeamersize{text margin left  = 1em,
text margin right = 1em}

\setbeamertemplate{frametitle}
{
\vspace{9.5mm}
\vbox
{
\bfseries\LARGE\strut\structure{\insertframetitle}\strut
}
\vspace{-0.8em}
}

\BeforeBeginEnvironment{block}
{
\begin{center}
\begin{minipage}{0.9485\textwidth}
}

\AfterEndEnvironment{block}
{
\end{minipage}
\end{center}
}

\setbeamercolor{block title}{fg = white, bg = structure}

\begin{document}

\begin{frame}
\frametitle{I}

\begin{block}{I}

\end{block}

\end{frame}

\end{document}


I hope I did understand you right. Here is a simplified version of the block definitions we use in the mtheme, which is as far as I can tell exactly what you want.

\documentclass{beamer}
\setbeamersize{text margin left  = 1em,
text margin right = 1em}

\setbeamertemplate{frametitle}{%
\vspace{9.5mm}
\vbox{%
\bfseries\LARGE\strut\structure{\insertframetitle}\strut
}
\vspace{-0.8em}
}

\setbeamercolor{block title}{fg = white, bg = structure}

\setbeamertemplate{block begin}{%
\vspace*{1ex}
\begin{beamercolorbox}[%
ht=2.4ex,
dp=1ex,
leftskip=0.5em,
rightskip=0.5em]{block title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}%
\vspace*{0.5em}
\usebeamerfont{block body}%
\begin{beamercolorbox}[%
dp=1ex,
leftskip=0.5em,
rightskip=0.5em,
vmode]{block body}%
}
\setbeamertemplate{block end}{%
\end{beamercolorbox}
\vspace*{0.2ex}
}

\begin{document}
\begin{frame}{Frametitle}
\begin{block}{Blocktitle}
Content of the block.
\end{block}
\end{frame}
\end{document}


The rectangle inner theme by the way does not do any changes with respect to the block definitions. So I removed it from your MWE.