2022 onwards
PDFTK is still a strong contender for many users with simple cross platform command lines for many tasks.
PDFtk Server does not require Adobe Acrobat or Reader, and it runs on Windows, Mac OS X and Linux.
You will see multiple commands in the other answers. But one drawback is that it needs to be licensed for distribution.
A commercial license is required to distribute PDFtk with your commercial product.
Another daily updated cross platform Solution is Ghostscript (but Windows binaries are often bi-annual) and it too requires a commercial license.
Its primary strength is the ability to merge nominated pages from both PostScript AND PDF along with other formats not handled by PDFTK. However it does not profess to be the optimum PDF merge tool. Again there are many well documented ways in StackOverflow answers to use that grandfather application for different combinational tasks, but may requires more complex approaches than a quick one liner, and many users will combine PDL or PS handling with PDFTK (above) for final overlay.
So what is updated frequently, and is available for commercial use and does the task in a single call? The answer is QPDF (licensed under the Apache License, Version 2.0), which has both overlay and underlay options with too many many other abilities to list, but is PDF only.
At its simplest one method is to write a new page from 2 others lets say just page 1, and not changing either source. The downside is that with so many options including passwords the syntax can become complex, good news is it may be overhauled in next version 11. Also beware it does not like file names with spaces.
First generate a new empty input file with page 1 from file1 (easy enough)
qpdf --empty --pages "file1.pdf" 1 -- "output.pdf"
Now overlay that with first page of file2 (this is a bit more complicated)
qpdf output.pdf --overlay "file2.pdf" --from=1 -- --replace-input
The commands can be combined in one simpler line and for this example lets use page 2 of file 1
qpdf --empty --pages "file1.pdf" 2 -- --overlay "file2.pdf" --from=1 -- "output2.pdf"
You will also need to be aware that mixing page sizes will work however perhaps not as expected so second on first is centered and reduced to fit.
