Edit I may have misunderstood the OPs intention and John Kormylo's answer is probably what is looked for. My intention was to print all the sheets, then fold them all together (not one after another), then staple and cut. If you have more than a very few sheets of paper, folding them together twice becomes quite cumbersome... so I let this answer just for posterity. At least, it was fun finding the algorithm :)
Edit 2: I guess I was a bit tired when I wrote my edit. My solution does indeed work if you fold each sheet once individually (horizontal fold), then stack them, bind them, and do the vertical fold after it. If you have a guillotine cutter, cut 1mm (or even less if you can) at the top, and you have your a6 booklet done.
The other answers work if you do both folds for each sheet of paper individually, then stack them with the first on the left and the last on the right. In this case, after binding, it doesn't look like a regular booklet though.
If you have for example 32 pages on 4 sheets of paper, my answer gives you a booklet of this form:

the others of this form:

Answer:

If this is what you're looking for, here is how I obtained it.
I produced the 78-page pdf (called numbered-pages.pdf) with:
\documentclass[a6paper]{article}
\usepackage{pgffor,graphicx}
\pagestyle{empty}
\begin{document}
\foreach \p in {1,...,78}
{
\vspace*{\stretch{1}}
{\centering\resizebox{!}{7cm}{\p}\par}
\vspace*{\stretch{1}}
\newpage
}
\end{document}
Then, I wrote a perl script in order to find the needed reordering of the 78 pages, including which ones should be rotated. I adapted the output to fit the format of the pdftk tool.
#!/usr/bin/perl
use strict;
exit if $#ARGV != 0;
my $total = $ARGV[0];
my $arrondi = $total;
if ($total%8) {$arrondi+=8-$total%8;}
exit if ($total < 1);
my $feuilles = $arrondi/8;
my $liste = "";
for (my $i=0; $i<$feuilles;$i++)
{
my $init = $i * 4 + 1;
my $final = $arrondi - $i * 4;
foreach my $page
($init,
$final,
$init+3,
$final-3,
$final-1,
$init+1,
$final-2,
$init+2,)
{
if ($page > $total){$liste .= "E ";}
elsif ($page == $init or $page == $final or $page == ($init+1) or $page == ($final -1))
{$liste .= 'A'.$page.'south ';}
else
{$liste .= 'A'.$page.' ';}
}
}
$liste .= "\n";
print $liste;
Call the script 8on2book.pl and ask for
$ 8on2book.pl 78
if you have 78 pages, which outputs
A1south E A4 A77 E A2south A78 A3 A5south A76south A8 A73 A75south A6south A74 A7 A9south A72south A12 A69 A71south A10south A70 A11 A13south A68south A16 A65 A67south A14south A66 A15 A17south A64south A20 A61 A63south A18south A62 A19 A21south A60south A24 A57 A59south A22south A58 A23 A25south A56south A28 A53 A55south A26south A54 A27 A29south A52south A32 A49 A51south A30south A50 A31 A33south A48south A36 A45 A47south A34south A46 A35 A37south A44south A40 A41 A43south A38south A42 A39
Integrate it in the command line for pdftk like this. It needs a 1-page blank pdf-file in the same directory (called page-blanche.pdf).
$ pdftk A=numbered-pages.pdf E=page-blanche.pdf cat A1south E A4 A77 E A2south A78 A3 A5south A76south A8 A73 A75south A6south A74 A7 A9south A72south A12 A69 A71south A10south A70 A11 A13south A68south A16 A65 A67south A14south A66 A15 A17south A64south A20 A61 A63south A18south A62 A19 A21south A60south A24 A57 A59south A22south A58 A23 A25south A56south A28 A53 A55south A26south A54 A27 A29south A52south A32 A49 A51south A30south A50 A31 A33south A48south A36 A45 A47south A34south A46 A35 A37south A44south A40 A41 A43south A38south A42 A39 output 8on2-ordered-pages.pdf
This gives you 80 reordered and rotated pages, called 8on2-ordered-pages.pdf, ready to print 4 on 1 double-sided.
Now, you may ask your printer to print 4 on 1 if your printing interface has this option (beware, it often adds margins between the pages and on the borders, so use this possibility with care).
Otherwise, use pdfpages to produce the final 4 on 1 pdf to be then printed two-sided:
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,nup=2x2]{8on2-ordered-pages.pdf}
\end{document}
I let as an exercise for the reader to pack this all in a script. The core is the algorithm in the perl script. In the other answers and the linked questions and answers, the point is not tackled. For instance, for 8 pages, the order is 1 8 4 5 7 2 6 3, but for 16 pages, it's not 1 8 4 5 7 2 6 3 9 16 12 13 15 10 14 11, but 1 16 4 13 15 2 14 3 5 12 8 9 11 6 10 7. In the other answers, the problem with more than 8 pages in tackled differently, see my edit at the top of this answer.
If pdfpages could rotate pages (or can it?), it would be a good solution too, also because it can create empty pages on the fly, which pdftk can't do.
pgfmorepagescan certainly do this. I don't know if any of the existing layouts will suit, but it isn't difficult to define new ones. Can you add a schematic of how you'd want the a6 pages laid out on the a4? – Andrew Stacey Mar 29 '22 at 05:458 on 2format can cope with any number of pages, but I can't tell if the eventual layout is correct as you haven't specified the order you want. – Andrew Stacey Mar 29 '22 at 21:24