Redesign input/output, add error checking

I modified the script to take input/output arguments on the command
line so it works like a regular command. Other options are still
kept as variables, but it's less likely those will need to be
changed. Also, help flags `-h' and `--help' are accepted.

The "output" directory is now considered the "staging" directory
for intermediate files, and by default the final output PDF file
will be placed in the execution path, not the staging directory.

I added some error checking features so that it's more likely
the script will exit gracefully when something goes wrong like an
invalid file path or a staging directory with no write permissions.