\documentclass[a4paper]{article}
\usepackage{geometry}

\pagestyle{empty}
\usepackage{pdfpages} % for \includepdf[pages=-]
\usepackage{xparse}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
	every node/.style = {
		inner sep = 0pt,
		anchor = north west,
	}
}

\ExplSyntaxOn

\int_new:N \l_impose_repetitions_int
\int_new:N \l_impose_counter_int
\dim_new:N \l_impose_creep_dim
\int_new:N \l_impose_total_pages_int
\int_new:N \l_impose_total_pages_to_four_int

\cs_new:Npn \impose_get_page:nn #1#2#3 {
	\int_compare:nT { ( #1 ) <= \l_impose_total_pages_int} {
		\int_compare:nT { ( #2 ) <= \l_impose_total_pages_int} {
			 \includepdf[pages={#1,#2 }, nup=1x2,landscape=false]{#3}
			 %#1 , #2 \newline
		}
	}
}

\NewDocumentCommand { \MakeBooklet } { O{0mm} m } {
	\int_zero:N \l_impose_counter_int
	\dim_zero:N \l_impose_creep_dim
	\pdfximage { #2 .pdf }
	\int_set:Nn \l_impose_total_pages_int
	{ \the \pdflastximagepages }
	\int_compare:nTF { \int_mod:nn { \l_impose_total_pages_int } { 4 } != 0 } {
		\int_set:Nn \l_impose_total_pages_to_four_int
		{ \l_impose_total_pages_int + 4 - \int_mod:nn { \l_impose_total_pages_int } { 4 } }
	} {
		\int_set_eq:NN \l_impose_total_pages_to_four_int \l_impose_total_pages_int
	}
	\int_set:Nn \l_impose_repetitions_int
	{ \l_impose_total_pages_to_four_int / 4 }
	\int_do_while:nn { \l_impose_counter_int < \l_impose_repetitions_int } {
		\clearpage
		\int_incr:N \l_impose_counter_int
		
		
		\impose_get_page:nn
		{ \int_eval:n {(\l_impose_counter_int-1)*4 + 1} }
		{ \int_eval:n {(\l_impose_counter_int-1)*4 + 3} }
		{ #2 }\newpage
		
		\impose_get_page:nn
		{ \int_eval:n {(\l_impose_counter_int-1)*4 + 2} }
		{ \int_eval:n {(\l_impose_counter_int-1)*4 + 4} }
		{ #2 }\newpage
		
		%\includepdf[pages={1,3}, nup=1x2,landscape=false]{#2}
		%\includepdf[pages={2,4}, nup=1x2,landscape=false]{#2}
		
		
		\dim_set:Nn \l_impose_creep_dim {
			#1 * \l_impose_counter_int / 2
		}
	}
}

\ExplSyntaxOff


\begin{document}
	
	% #1 = Verschiebung pro Bogen (optional)
	% #2 = Dateiname (ohne Endung!). Datei muss eine PDF sein!
	\MakeBooklet[0.24mm]{booklet_auto}
	
\end{document}
