Let's say I've got some ASCII art:
___ ,"---". : ; `-.-' | | | | | | _.-\_/-._ _ / | | \ _ / / `---' \ \ / `-----------' \ /,-""-. ,-""-.\ ( i-..-i i-..-i ) |`| |-------| |'| \ `-..-' ,=. `-..-'/ `--------|=|-------' | | \ \ ) ) hjw / / ( ( (Source)
But I want to focus on the cable of this joystick, because I actually want a picture of a garden path, leading up to a door.
,=. -|=|- | | \ \ ) ) / / ( ( I could copy out line after line, I could use a text editor with block selection mode, or... I could write some code!
So, my code needs five arguments:
- A piece of ASCII art, a newline separated string.
- The X axis of the top-left corner (1-indexed, from left hand column, positive integer)
- The Y axis of the top-left corner (1-indexed, from top row, positive integer)
- Width of the resultant image (positive integer)
- Height of the resultant image (positive integer)
Test Cases
ASCII image:
___ ,"---". : ; `-.-' | | | | | | _.-\_/-._ _ / | | \ _ / / `---' \ \ / `-----------' \ /,-""-. ,-""-.\ ( i-..-i i-..-i ) |`| |-------| |'| \ `-..-' ,=. `-..-'/ `--------|=|-------' | | \ \ ) ) hjw / / ( ( Garden path
- X: 10
- Y: 15
- Width: 5
- Height: 7
Result:
,=. -|=|- | | \ \ ) ) / / ( ( DB icon
- X: 3
- Y: 12
- Width: 6
- Height: 4
Output:
,-""-. i-..-i | | `-..-' Alien Elder
- X: 9
- Y: 1
- Width: 7
- Height: 10
___ ,"---". : ; `-.-' | | | | | | .-\_/-. | | `---' Signature
- X: 16
- Y: 19
- Width: 3
- Height: 1
hjw Rules
- Output can be given by any convenient method.
- Either a full program or a function are acceptable.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Yshould bew15, and in TC 2,Xshould be3\$\endgroup\$