What I have now is this:
function rangeIntersect(min0, max0, min1, max1) {
return Math.max(min0, max0) >= Math.min(min1, max1) && Math.min(min0, max0) <= Math.max(min1, max1);
};
function boxIntersect(x0, y0, w0, h0, x1, y1, w1, h1) {
return rangeIntersect(x0, x0 + w0, x1, x1 + w1) && rangeIntersect(y0, y0 + h0, y1, y1 + h1);
}