In order to add a CropBox (to a page) you can use an EndPage procedure, by sending a pdfmark at the end of the page, instead of the beginning, it should overwrite any pre-existing CropBox.
Or more simply, you can simply render a portion of the media directly, which sounds like what you want to do in the first place and avoids a (potentially lengthy) processing step.
Set the media size to the area you want to be rendered. For now lets assume you want a 2 inch square, 1 inch up from the bottom of the page. So we start by making the media size 2 inches square, and fixing it so any input can't change it:
-dDEVICEWIDTHPOINTS=144 -dDEVICEHEIGHTPOINTS=144 -dFIXEDMEDIA
If you add that to the command line you use to render the PDF file you will see that you get a 2 inch square rendered. Of course right now that's the bottom left corner of the page, so now we need to shift the media position so that the portion we want lies on the page. To do that we use PostScript, specifically the PageOffet key in the page device dictionary:
<</PageOffset [-72 0]>> setpagedevice
Note that we are shifting the bottom left corner of the page, which is why we use -72, we want the corner to go down.
because we are using PostScript we need to introduce it with the -c and -f switches:
-c "<</PageOffset [-72 0]>> setpagedevice" -f
So the whole command line becomes:
./gs -dDEVICEWIDTHPOINTS=144 -dDEVICEHEIGHTPOINTS=144 -dFIXEDMEDIA -c "<</PageOffset [-72 0]>> setpagedevice" -f input.pdf
If you really want to add a CropBox and produce a PDF file then you need to add an EndPage procedure, which will add a CropBox to every page individually:
./gs -sDEVICE=pdfwrite -o ./marked.pdf -c "<</EndPage {0 eq {[/CropBox [300 400 400 600] /PAGE pdfmark pop true}{pop false}ifelse}>>setpagedevice" -f "c:\big boat.pdf