i've got a ploblem with the collisions, here is how I do it:

for each edge of rectangle1(the small one), I make a vector with the velocity of the rectangle and check every line on rectangle2 and get the closest intersection point, I then do the same with the edges of rectangle2 and the lines of rectangle1, and keep the closest line/point
so basically, the red square represents the first edge that will collide with the object and the green square represent the point on the line where it will collide
the blue line is the velocity of the small rectangle
the red line represents the collision reaction, the distance the red square need to travel to touch the other rectangle
the pale green represents where the object should slide
the dark green represents the colliding line
now here is the problem: after the action is taken and the 2 rectangles collide, the edge is ON the line and that makes my line/point algorithm fail on some occasions (like when the rectangle is at a certain angle)
my first thougth was to 'push' the rectangle just a bit towards the colliding line's normal so that it is over the line instead of directly on it, it worked great, but the problem came back when I added gravity, if I use a very very low gravity the rectangle will go down so slow that it will eventually go trought the line ( i guess it moves so slowly that it can get very close to the line, enough so that my intersection algorithm fails like when the point is directly on the line)