Make "Draw lines better" patch work for rectangle sudokus

The patch "Draw lines better" (17bf6cbf) assumes the "blocks" are squares.
The code of the library could in fact handle other cases.
This patch should support them (even if it's not testable now).

Patch proposed by Arnaud Bonatti.
Minor fixes and rebase by Parin Porecha.