From this great answer:
For the whole screen
$ import -window root path/to/output.png
For a selected window
$ WINDOW=$(xdpyinfo | grep focus) && import -window $WINDOW /path/to/output.png
For a specific area (this is awesome)
$ import /path/to/output.png