Scaling down images could create images with a width or height of zero.
Clamp at 1 to prevent a crash, also add an assert to scaling functions.
When attempting to scale a wide-aspect image like 4096x64 down to icon
sizes of 32x32 a scaling factor of 128 was calculated. This would result
in the final size being 32x0.5 and that 0.5 is truncated down to 0.
Clamp both dimensions to at least 1 now. The aspect ratio will not be
preserved for such images, but it's better than a crash.